package com.jcw.kqxt.attendance_rule.controller;

import com.jcw.kqxt.attendance_rule.model.ConfigParamDto;
import com.jcw.kqxt.attendance_rule.model.RuleParamDto;
import com.jcw.kqxt.attendance_rule.service.AttendanceRuleService;
import com.jcw.kqxt.result.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 考勤规则
 */
@RestController
@RequestMapping("rule")
public class AttendanceRuleController {

    @Autowired
    private AttendanceRuleService attendanceRuleService;

    /**
     * 人员列表
     * @return
     */
    @GetMapping("user/list")
    public JSONResult userList() {
        return JSONResult.success(attendanceRuleService.userList());
    }

    /**
     * 当前考勤内勤
     * @return
     */
    @GetMapping("attendanceUser/list")
    public JSONResult attendanceUser() {
        return JSONResult.success(attendanceRuleService.attendanceUser());
    }

    @PostMapping("addWeekdaysAdmin")
    public JSONResult addWeekdaysAdmin(@RequestBody ConfigParamDto paramDto) {
        attendanceRuleService.addWeekdaysAdmin(paramDto);
        return JSONResult.success();
    }

    @PostMapping("weekdaysConfig")
    public JSONResult weekdaysConfig(@RequestBody RuleParamDto paramDto) {
        return JSONResult.success(attendanceRuleService.weekdaysConfig(paramDto));
    }

    @PostMapping("editWeekdays")
    public JSONResult editWeekdays(@RequestBody RuleParamDto paramDto) {
        return JSONResult.success(attendanceRuleService.editWeekdays(paramDto));
    }






}
